libxl: fix migrate for HVM guests
authorIan Campbell <ian.campbell@citrix.com>
Mon, 14 Feb 2011 17:02:55 +0000 (17:02 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 14 Feb 2011 17:02:55 +0000 (17:02 +0000)
commit6589a2fe4e50d03b97a320ed3fe845e383140bed
treec929eddea8ad7586cc2b9d02b3450a7b968ad96d
parentfb37da1031eb8ed399b9b52a0eebb8b24e005999
libxl: fix migrate for HVM guests

Prior to 22909:6868f7f3ab3f libxl would loop waiting simultaneously
for the domain the acknowledge a PV suspend request (by clearing the
XenStore node) and for the domain to actually suspend. For HVM guests
without PV drivers this same loop was simply waiting for the domain to
suspend.

In 22909:6868f7f3ab3f the original loop was split into two loops
(first waiting for the acknowledgement and then for the actual
suspend). This caused libxl to incorrectly wait for an HVM guest
without PV drivers to acknowledge the XenStore request, which is not
something it would ever do.

Fix this by only waiting for an acknowledgement from a guest which
contains PV drivers.

Previously we were also making the request regardless of whether the
guest had PV drivers, change that to only make the request if the
guest has PV drivers.

Lastly there is no need to sample HVM_PARAM_ACPI_S_STATE twice and not
doing so simplifies the test for PVHVM vs. normal HVM guests.

Tested with:
Windows with GPL PV drivers (event channel suspend mode)
Windows without PV drivers (xc_domain_shutdown mode)
Linux PV (PV with XenBus control node mode)
Linux HVM (PVHVM with XenBus control node mode (*))
Linux HVM (xc_domain_shutdown mode)

(*) In this case the kernel didn't actually suspend, due to:
PM: Device input1 failed to suspend: error -22
xen suspend: dpm_suspend_start -22
    which may be a misconfiguration in my setup or may be a kernel
    bug, but the libxl side dealt with this as gracefully as it could.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_dom.c